import { httpUrl } from 'api/config';
import { ajaxPost } from 'api/axios';
import { changeDataType } from 'common/js/util';

export function getQueue() {
	let url = `${httpUrl}/redis/redisQueue`;
	
	let data = {};
	
	return ajaxPost(url, changeDataType(data))
		.then(res => {
			return Promise.resolve(res)
		})
		.catch(res => {
			return Promise.reject(res)
		})
}

export function getMem() {
	let url = `${httpUrl}/redis/getMemeryInfo`;
	
	let data = {};
	
	return ajaxPost(url, changeDataType(data))
		.then(res => {
			return Promise.resolve(res)
		})
		.catch(res => {
			return Promise.reject(res)
		})
}

export function getInfo() {
	let url = `${httpUrl}/redis/redisMonitor`;
	
	let data = {};
	
	return ajaxPost(url, changeDataType(data))
		.then(res => {
			return Promise.resolve(res)
		})
		.catch(res => {
			return Promise.reject(res)
		})
}

export function getKey() {
	let url = `${httpUrl}/redis/getKeysSize`;
	
	let data = {};
	
	return ajaxPost(url, changeDataType(data))
		.then(res => {
			return Promise.resolve(res)
		})
		.catch(res => {
			return Promise.reject(res)
		}) 
}

